<template>
  <el-dialog :title=" isAdd ? '添加菜单' : '编辑菜单'" :visible.sync="isShow" center :before-close="cancel">
  <!-- <el-form :model="form">
    <el-form-item label="活动名称" :label-width="formLabelWidth">
      <el-input v-model="form.name" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="活动区域" :label-width="formLabelWidth">
      <el-select v-model="form.region" placeholder="请选择活动区域">
        <el-option label="区域一" value="shanghai"></el-option>
        <el-option label="区域二" value="beijing"></el-option>
      </el-select>
    </el-form-item>
  </el-form> -->
  <div slot="footer" class="dialog-footer">
    <el-button @click="cancel">取 消</el-button>
    <el-button type="primary" @click="sure">确 定</el-button>
  </div>
</el-dialog>
</template>

<script>
export default {
    //接收来自父组件的数据
    props:["isShow","isAdd"],
    data(){
        return {
            
        }
    },
    //方法
    methods:{
        //1.点击取消按钮，关闭弹框
        cancel(){
            //a.通知父组件修改数据-关闭弹框 isShow修改父组件的数据  子传父
            this.$emit("cancel")
        },

        //2.点击确定按钮
        sure(){
            //a.关闭弹框
            this.cancel();

            //b.添加/编辑
            if(this.isAdd){
                console.log("添加")
            }else{
                console.log("编辑")
            }
        }
    }
}
</script>

<style>

</style>